<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<section class="new-api" ng-class="{'new-api-import': $ctrl.isImport}">
  <md-toolbar class="md-table-toolbar md-default" style="background-color: #fbfbfc">
    <div class="md-toolbar-tools">
      <span>Create an API</span>
    </div>
  </md-toolbar>
  <div layout="column">
    <div layout="row" layout-align="center" style="margin-top: 40px">
      <div layout="column" class="import-container">
        <div class="card-import">
          <div class="title">{{$ctrl.getImportTitle()}}</div>
          <div class="description">
            <abbr title="The import refer to the definition version included in file to choose the DESIGN MODE">API definition</abbr>
            or your Swagger descriptor file or a WSDL
          </div>
          <gv-api-import
            policies="$ctrl.policies"
            definition-version="$ctrl.definitionVersion"
            cancel-action="$ctrl.cancelImport()"
          ></gv-api-import>
        </div>
      </div>
    </div>
    <div layout="row" class="card-container" layout-align="center" style="margin-top: 40px">
      <div layout="column" ng-class="{selected: $ctrl.definitionVersion ==='2.0.0', 'definition-container': true}">
        <div class="card" ng-click="$ctrl.definitionVersion='2.0.0'">
          <span class="title">{{$ctrl.getDefinitionVersionTitle('2.0.0')}}</span>
          <gv-image src="assets/api-design-studio.png"></gv-image>
          <span class="description">{{$ctrl.getDefinitionVersionDescription('2.0.0')}}</span>
        </div>

        <div class="actions">
          <gv-button primary class="import-action" icon="code:left-circle" outlined ng-click="$ctrl.isImport = false">Cancel </gv-button>
          <gv-button primary icon="general:upload" outlined ng-click="$ctrl.isImport = true">Import</gv-button>
          <gv-button primary icon-right="code:right-circle" ui-sref="management.apis.create({definitionVersion: $ctrl.definitionVersion})"
            >Create
          </gv-button>
        </div>
      </div>

      <div layout="column" ng-class="{ selected: $ctrl.definitionVersion==='1.0.0', 'definition-container': true}">
        <div class="card" ng-click="$ctrl.definitionVersion='1.0.0'">
          <span class="title">{{$ctrl.getDefinitionVersionTitle('1.0.0')}}</span>
          <gv-image src="assets/api-design-paths.png"></gv-image>
          <span class="description">{{$ctrl.getDefinitionVersionDescription('1.0.0')}}</span>
        </div>

        <div class="actions">
          <gv-button icon="general:upload" outlined ng-click="$ctrl.isImport = true">Import</gv-button>
          <gv-button class="import-action" icon="code:left-circle" outlined ng-click="$ctrl.isImport = false">Cancel </gv-button>
          <gv-button icon-right="code:right-circle" ui-sref="management.apis.create({definitionVersion: $ctrl.definitionVersion})"
            >Create
          </gv-button>
        </div>
      </div>
    </div>
  </div>
</section>
